<meta charset="UTF-8">
<?php
require ('./lib/init.php');
$number = 1;
// 判断用户是否登录
if (!acc()) {
    header('Location:login.php');
}

//分页代码
$sql = "select count(*) from user";
$num = mGetOne($sql);//总用户数量
$curr = isset($_GET['page']) ? $_GET['page'] : 1;//当前页码
$cnt = 7 ;//每页显示条数
$page = getPage($num,$curr,$cnt);
// 查询所有用户
$sql = "select id,name,role_name,mail from user left join role on role.role_id = user.role_id where 1 " . ' order by id  limit ' . ($curr-1) * $cnt . ',' . $cnt;
$users = mGetAll($sql);
require (ROOT . '/view/admin/role.html');
?>
